
package net.swa.dewei.beans.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.GenericGenerator;

/**门店信息表**/
@Entity
@Table(name = "t_ChongdianZhan")
public class ChongdianZhan implements Comparable<ChongdianZhan>
{
    //PK
    private Long id;

    //门店要一个微信id
    private String wxid;

    /**名称**/
    private String name;

    /**经度**/
    private Double latitude;

    /**维度**/
    private Double longitude;

    /**地址**/
    private String address;

    /**联系人**/
    private String lxr;

    /**联系人电话**/
    private String lxrTel;

    /**店面图片**/
    private String imageUrl;

    /**详细说明**/
    private String detailInfo;

    /**创建时间**/
    private String crateDate;

    /**更新时间**/
    private String updateDate;

    /**是否推荐店面（不做实体映射）*/
    private boolean tuijian;

    /**省**/
    private String province;

    /**市*/
    private String city;

    /**县**/
    private String town;

    /**服务站id*/
    private Long fuwuzhanId;

    private String fuwuzhanName;

    /***距离目标点距离，不做数据库映射**/
    private String distance;

    /***距离目标点距离,做比较使用不做数据库映射**/
    private Double doubleDistance;

    /**状态 0删除 1有效***/
    private Integer status;

    //若是门店的对应门店id
    private Long mendianId;

    @GenericGenerator(name = "generator", strategy = "native")
    @Id
    @GeneratedValue(generator = "generator")
    @Column(name = "id", unique = true, nullable = false)
    public Long getId()
    {
        return id;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    @Column(name = "name", length = 255)
    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @Column(name = "latitude", length = 18)
    public Double getLatitude()
    {
        return latitude;
    }

    public void setLatitude(Double latitude)
    {
        this.latitude = latitude;
    }

    @Column(name = "longitude", length = 18)
    public Double getLongitude()
    {
        return longitude;
    }

    public void setLongitude(Double longitude)
    {
        this.longitude = longitude;
    }

    @Column(name = "address", length = 500)
    public String getAddress()
    {
        return address;
    }

    public void setAddress(String address)
    {
        this.address = address;
    }

    @Column(name = "lxr", length = 255)
    public String getLxr()
    {
        return lxr;
    }

    public void setLxr(String lxr)
    {
        this.lxr = lxr;
    }

    @Column(name = "lxrTel", length = 255)
    public String getLxrTel()
    {
        return lxrTel;
    }

    public void setLxrTel(String lxrTel)
    {
        this.lxrTel = lxrTel;
    }

    @Column(name = "imageUrl", length = 500)
    public String getImageUrl()
    {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl)
    {
        this.imageUrl = imageUrl;
    }

    @Column(name = "detailInfo", length = 500)
    public String getDetailInfo()
    {
        return detailInfo;
    }

    public void setDetailInfo(String detailInfo)
    {
        this.detailInfo = detailInfo;
    }

    @Column(name = "crateDate", length = 30)
    public String getCrateDate()
    {
        return crateDate;
    }

    public void setCrateDate(String crateDate)
    {
        this.crateDate = crateDate;
    }

    @Column(name = "updateDate", length = 30)
    public String getUpdateDate()
    {
        return updateDate;
    }

    public void setUpdateDate(String updateDate)
    {
        this.updateDate = updateDate;
    }

    public Long getMendianId()
    {
        return mendianId;
    }

    public void setMendianId(Long mendianId)
    {
        this.mendianId = mendianId;
    }

    @Transient
    public boolean isTuijian()
    {
        return tuijian;
    }

    public void setTuijian(boolean tuijian)
    {
        this.tuijian = tuijian;
    }

    public String getProvince()
    {
        return province;
    }

    public void setProvince(String province)
    {
        this.province = province;
    }

    public String getCity()
    {
        return city;
    }

    public void setCity(String city)
    {
        this.city = city;
    }

    public String getTown()
    {
        return town;
    }

    public void setTown(String town)
    {
        this.town = town;
    }

    public Long getFuwuzhanId()
    {
        return fuwuzhanId;
    }

    public void setFuwuzhanId(Long fuwuzhanId)
    {
        this.fuwuzhanId = fuwuzhanId;
    }

    @Column(name = "wxid", length = 255)
    public String getWxid()
    {
        return wxid;
    }

    public void setWxid(String wxid)
    {
        this.wxid = wxid;
    }

    @Transient
    public String getFuwuzhanName()
    {
        return fuwuzhanName;
    }

    public void setFuwuzhanName(String fuwuzhanName)
    {
        this.fuwuzhanName = fuwuzhanName;
    }

    @Transient
    public String getDistance()
    {
        return distance;
    }

    public void setDistance(String distance)
    {
        this.distance = distance;
    }

    public Integer getStatus()
    {
        return status;
    }

    public void setStatus(Integer status)
    {
        this.status = status;
    }

    @Transient
    public Double getDoubleDistance()
    {
        return doubleDistance;
    }

    public void setDoubleDistance(Double doubleDistance)
    {
        this.doubleDistance = doubleDistance;
    }

    @Override
    public int compareTo(ChongdianZhan o)
    {
        if (null == this.doubleDistance && null != o.getDoubleDistance())
        {
            return 1;
        }
        else if (null != this.doubleDistance && null == o.getDoubleDistance())
        {
            return -1;
        }
        else if (null != this.doubleDistance && null != o.getDoubleDistance())
        {
            if (this.doubleDistance > o.getDoubleDistance())
            {
                return 1;
            }
            if (this.doubleDistance < o.getDoubleDistance())
            {
                return -1;
            }
            return 0;
        }
        else
        {
            return 0;
        }
    }

}